package com.github.dabai.aggregation;

import lombok.Getter;
import lombok.Setter;

@Setter
@Getter
public class GroupByField<I> {
	private String name;
	private String mapppingName;
	private IGroupByFieldConvert<I> convert = null;

	public GroupByField(String name, String mapppingName, IGroupByFieldConvert<I> convert) {
		super();
		this.name = name;
		this.mapppingName = mapppingName;
		this.convert = convert;
	}

	@SuppressWarnings("unchecked")
	public GroupByField(String name, String mapppingName) {
		this.name = name;
		this.mapppingName = mapppingName;
		this.convert = (IGroupByFieldConvert<I>) new IGroupByFieldConvert.StringGroupByFieldConvert();
	}

	@SuppressWarnings("unchecked")
	public GroupByField(String name, String mapppingName, String dateFormatPattern) {
		this.name = name;
		this.mapppingName = mapppingName;
		this.convert = (IGroupByFieldConvert<I>) new IGroupByFieldConvert.DateGroupByFieldConvert(dateFormatPattern);
	}
}
